#include<stdio.h>

void fan(int n, char A, char B, char C)
{
	static int count = 1;
	if(n<1)
	{
		printf("error");
	}
	else if(n == 1)
	{
		printf("%d:\t%c->%c\n",count,A,C);
		count++;
	}
	else if(n>1)
	{
		fan(n-1,A,B,C);
		fan(1,A,C,B);
		fan(n-1,B,C,A);
	}
	
}
int main()
{
	int input = 0;
	scanf("%d",&input);
	fan(input,'A','B','c');	
	
	return 0;
}
